home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 1
/
Atari Mega Archive - Volume 1.iso
/
gnu
/
fpu881
/
src6.zoo
/
pow.c
< prev
next >
Wrap
C/C++ Source or Header
|
1991-09-24
|
461b
|
39 lines
/*
computes a^b.
uses log and exp
*/
#include <errno.h>
int errno;
double log(double), exp(double);
double
pow(arg1,arg2)
double arg1, arg2;
{
double temp;
long l;
if(arg1 <= 0.)
{
if(arg1 == 0.)
{
if(arg2 <= 0.)
goto domain;
return(0.);
}
l = arg2;
if(l != arg2)
goto domain;
temp = exp(arg2 * log(-arg1));
if(l & 1)
temp = -temp;
return(temp);
}
return(exp(arg2 * log(arg1)));
domain:
errno = EDOM;
return(0.);
}